package com.lxyk.dao.user;

import com.lxyk.domain.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserInfoDao {

    @Insert("insert into user_info values(null,#{gender},#{name},#{jobName},#{phone},#{birthday},#{idCard},#{position},#{entryTime},#{uid})")
    public void save(UserInfo userInfo);

    //根据用户id查询用户详情
    @Select("select * from user_info where uid=#{uid}")
    public UserInfo findByUid(Integer uid);

    //更新数据
    @Update("update user_info set gender=#{gender},name=#{name},jobName=#{jobName},phone=#{phone}," +
            "birthday=#{birthday},idCard=#{idCard},position=#{position},entryTime=#{entryTime} where id=#{id}")
    public Integer update(UserInfo userInfo);

    //查询所有用户信息
    @Select("select * from user_info")
    public List<UserInfo> findAll();
}
